<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
    </div>
    <div id="app2">
        第二个组件
        <my-cpn></my-cpn>
        <my-cpntwo></my-cpntwo>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const myComponent = Vue.extend({
            template:`
                <div>我是一个组件</div>
            `
        })
        Vue.component('my-cpn',myComponent)
        const app = new Vue({
            el:'#app',
        })
        const app2 = new Vue({
            el:'#app2',
            components:{
                'my-cpntwo':myComponent
            }
        })
    
    </script>
</body>
</html>